<template>
  <div class="contentDX">
    <div class="TX_TOP">
      <div style="display: flex; margin-left: 20px">
        <van-image
          class="imgTX"
          color="#fff"
          :src="require('../../static/ry.png')"
          mode=""
        ></van-image>
        <!-- <image class="imgTX" src="../static/ry.png" mode=""></image> -->
        <div
          style="
            display: flex;
            align-items: center;
            justify-content: space-between;
          "
        >
          <div style="display: flex; flex-direction: column; line-height: 25px">
            <div style="color: #fff; font-size: 15px">{{ name }}</div>
            <div style="color: #fff; font-size: 12px">{{ mobile }}</div>
          </div>
        </div>
      </div>
      <div
        style="padding-right: 10px; display: flex; align-items: center"
        @click="QHxx"
      >
        <div style="font-size: 16px; margin-right: 5px">退出</div>
        <!-- <van-image
          width="20px"
          height="20px"
          color="#fff"
          :src="require('../imgs/QH.png')"
          mode=""
        ></van-image> -->
      </div>
    </div>
    <div class="tabXX">
      <div class="ul">
        <div class="li" @click="SMtz">
          <van-image
            class="img"
            width="35px"
            height="35px"
            :src="require('../imgs/HX.png')"
            mode="widthFix"
          ></van-image>
          <div class="text">核销</div>
        </div>
        <!-- <div class="li" @click="DDGL">
          <van-image
            class="img"
            width="35px"
            height="35px"
            :src="require('../imgs/DD.png')"
            mode="widthFix"
          ></van-image>
          <div class="text">订单管理</div>
        </div> -->
        <div class="li" @click="PJ">
          <van-image
            class="img"
            width="35px"
            height="35px"
            :src="require('../imgs/DPJ.png')"
            mode="widthFix"
          ></van-image>
          <div class="text">后台管理</div>
        </div>
      </div>
    </div>
    <div class="XXlist">
      <div class="title" style="padding: 10px; box-sizing: border-box">
        <div class="file">
          <div class="Kuai"></div>
          <div class="">经营数据</div>
        </div>
        <div class="file" @click="jumpToDetail">
          <div style="color: rgb(128, 128, 128)">更多</div>
          <van-icon
            name="arrow"
            color="rgb(128, 128, 128)"
            size="20"
          ></van-icon>
        </div>
      </div>
      <div class="ul">
        <div
          class="li"
          v-for="(item, index) in list"
          @click="TZdy(item)"
          :key="index"
        >
          <van-image
            class="img"
            width="35px"
            height="35px"
            :src="item.auditImage"
            mode="widthFix"
          ></van-image>
          <div class="name">
            {{ item.siteName }}
          </div>
          <div class="num">
            {{ item.orderNumber }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  getpersonalInformation,
  setpersonalInformation,
} from "../../common/RYXX";
import { updateUserVersions } from "@/api/realAssets/icsharedstation/manager.js";
import { getandroidCode } from "../../common/auth";
import {
  getSiteOrderList,
  getOrderTime,
} from "@/api/realAssets/icsharedstation/GLYapi/home.js";
export default {
  data() {
    return {
      name: JSON.parse(getpersonalInformation()).userName,
      mobile: JSON.parse(getpersonalInformation()).mobile,
      list: [],
    };
  },
  created() {},
  mounted() {
    // if (getandroidCode() == "") {
    //   this.$router.push({
    //     name: "rvicsharedstation-index",
    //     query: {
    //       id: 0,
    //     },
    //   });
    // }
    this.queryList();
  },
  methods: {
    //跳转对应
    TZdy(item) {
      // let obj={
      // 	siteId=${item.id}&siteName=${item.siteName}
      // }
      // uni.setStorageSync('DYDD', this.title)

      this.$router.push({
        name: "rvicsharedstation-AdminPages_DYDD_index",
        query: {
          siteId: item.id,
          siteName: item.siteName,
        },
      });
      // router.push(
      //   `/pages/AdminPages/DYDD/index?siteId=${item.id}&siteName=${item.siteName}`
      // );
    },
    jumpToDetail() {
      this.$router.push("icsharedstation_AdminPages_JYSJ_index");
    },
    queryList() {
      this.name = JSON.parse(getpersonalInformation()).userName;
      this.mobile = JSON.parse(getpersonalInformation()).mobile;
      getSiteOrderList({
        postId: JSON.parse(getpersonalInformation()).postId,
        userId: JSON.parse(getpersonalInformation()).userId,
      }).then((res) => {
        this.list = res.data;
        //获取当日订单
        getOrderTime({
          userId: JSON.parse(getpersonalInformation()).userId,
          postId: JSON.parse(getpersonalInformation()).postId,
          frontTime: "",
          backTime: "",
        }).then((resXX) => {
          if (resXX.data[0].orderName == "订单总量") {
            let obj = {
              auditImage: "http://img.benson-info.com/ishapp/icon/jr.png",
              id: "9999",
              siteName: "订单总量",
              orderNumber: resXX.data[0].orderNum,
            };
            this.list.unshift(obj);
            console.log("获取页面数据", this.list);
          }
        });
      });
    },
    DDGL() {
      // router.push("/pages/AdminPages/DDGL/index");
    },
    SMtz() {
      // router.push({
      //   name: "SMXX",
      // });
    },
    //跳转后台管理
    PJ() {
      this.$router.push({
        name: "rvicsharedstation-HT_index",
      });
    },
    //切换用户
    QHxx() {
      this.$router.push({
        path: "/mainFrame/home",
      });
    },
  },
};
</script>

<style  lang="less" scoped>
.contentDX {
  height: 100%;
  width: 100%;
  background: url("../../static/Homeimg/SYBJ1.png") no-repeat;
  background-size: 100% 100%;
  position: relative;
  overflow-x: auto;
  .TX_TOP {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: #fff;

    .imgTX {
      width: 62px;
      height: 62px;
      border-radius: 50%;
      margin-right: 10px;
    }
  }

  .tabXX {
    width: 95%;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 10px;
    background: #fff;
    margin: 0 auto;

    .ul {
      display: flex;
      justify-content: space-around;
      .li {
        display: flex;
        flex-direction: column;
        align-items: center;

        /* 使图片居中 */
        .img {
          // display: flex;
          // justify-content: center;
        }
      }

      .text {
        text-align: center;
        font-size: 12px;
        color: rgb(56, 56, 56);
        margin-top: 3px;
      }
    }
  }

  .XXlist {
    margin-top: 20px;
    background: #fff;
    box-sizing: border-box;
    padding: 10px;

    .ul {
      overflow: auto;
      display: flex;
      // justify-content: space-around;
      flex-wrap: wrap;
      // padding: 10px;
      //padding-bottom: 110px;
      box-sizing: border-box;

      .li {
        background: rgba(245, 250, 250, 1);
        width: 27%;
        height: 75px;
        margin: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 5px 0;

        .name {
          font-size: 10px;
          margin-top: 5px;
        }

        .num {
          margin-top: 3px;
          font-size: 14px;
        }
      }
    }

    .title {
      display: flex;
      justify-content: space-between;
      font-size: 14px;
      .file {
        display: flex;
        align-items: center;
        .Kuai {
          background: linear-gradient(
            47.9deg,
            rgba(0, 186, 173, 1) 76.54%,
            rgba(0, 186, 173, 1) 23.73%
          );
          width: 13px;
          height: 20px;
          margin-right: 5px;
        }
      }
    }
  }
}
</style>
